package study.各种map性能对比;

import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;

public class TestMap {

	private static  ConcurrentHashMap  concurrentMap=new ConcurrentHashMap();
	private static HashMap hashMap = new HashMap<>();
	
	public static void main(String[] args) {
//		Thread thread  = new Thread( new threadTest2( ));
//		thread.start();
		final HashMap map2 = new HashMap<>();
//		Collections.synchronizedMap(map2);
		
		Runnable runnable = new Runnable() {
			int i =0 ;
			@Override
			public void run() {
				long startTime = System.currentTimeMillis();
				while( System.currentTimeMillis()-startTime<1000 )
				{
					i++;
//					concurrentMap.put(i, "测试"+i);
					map2.put(i, "测试"+i);
				}
//				System.out.println(concurrentMap.size());
				System.out.println(map2.size());
			}
		};
		for (int i = 0; i < 5; i++) {
			new Thread(runnable).start();
		}
		
		
		
	}
	
}
